package com.fairytask.ui.item
{
	import com.fairytask.engine.components.BaseItem;
	import com.fairytask.engine.components.clip.Clip;
	import com.fairytask.engine.components.text.Label;
	import com.fairytask.engine.define.Filter;
	public class LineupItem extends BaseItem
	{
		private var _photo			:Clip;			//添加的图片
		private var _label			:Label;			//添加的文字
		private var _fight			:Clip;			//添加的战字
		private var _source		:String;		//图片的资源
		private var _fsource		:String;		//战字的图片资源
		
		public function LineupItem()
		{
			//元素的图片
			_photo		=	new Clip();
			_photo.x	=	5;
			_photo.y	=	5;
			_photo.width	=	50;
			_photo.height	=	50;
			//添加的战字
			_fight	=	new Clip();
			_label	=	new Label();
			addChild(_photo);

		}
		
		
		public function set pSource(val:String):void
		{
			_photo.source	=	val;
		}
		
		public function set fSource(val:String):void
		{
			_fight.source	=	val;
		}
		public function set pX(val:int):void
		{
			_photo.x	=	val;
		}
		
		public function set pY(val:int):void
		{
			_photo.y	=	val;
		}
		
		//添加战字
		public function addFight(val:String):void
		{	
			
			_fight.source	=	val;
			_fight.x	=	_fight.y	=	45;
			if(contains(_fight))
			{
				return;
			}
			addChild(_fight);
		}
		
		//删除战字
		
		public function removeFight():void
		{
			if(contains(_fight))
			{
				removeChild(_fight);
			}
		}
		
		//添加文字
		public function addLabel(val:String):void
		{
			
			_label.htmlStr	=	val;
			_label.x	=	50;
			_label.y	=	25;
			addChild(_label);
		}
		
		//删除文字
		
		public function removeLabel():void
		{
			if(contains(_label))
			{
				removeChild(_label);
			}
		}
		
		//添加选中的效果
		
		public function addSelect():void
		{
			_photo.filters	=	[Filter.YELLOW_INNER];
		}
		
		//移除选中效果
		
		public function removeSelect():void
		{
			_photo.filters	=	null;
		}
		
		/**
		 * 改变label的位置
		 */
		public function set labelX(val:int):void
		{
			_label.x	=	val;
		}
		
		public function set labelY(val:int):void
		{
			_label.y	=	val;
		}
	}
}